﻿package net.wangit.jdbc.sqltype;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;

public class LongSqlType extends NullableSqlType {

	private static final long serialVersionUID = 1L;

	public LongSqlType() {
	}

	public String get(ResultSet rs, String name) throws SQLException {
		long value = rs.getLong(name);
		if (rs.wasNull())
			return null;
		else
			return Long.toString(value);
	}

	public void setNotNull(PreparedStatement st, String value, int index)
			throws SQLException {
		st.setLong(index, Long.parseLong(value));
	}

	public int sqlType() {
		return Types.BIGINT;
	}
}
